package com.iris.live.services.services;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.iris.live.services.data.models.*;
import com.iris.live.services.models.PageData;
import com.iris.live.services.models.RequestBase;
import com.iris.live.services.models.ResultData;
import com.iris.live.services.vo.crm.QuoteFinanceInfo;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by sxy on 2016/7/27.
 */
public interface FinanceService {

    PageData getFinanceInfoList(String permit, GetFinanceInfoListRequest request);

    PageData getFinanceProductList(String permit, GetFinanceProductListRequest request);

    ResultData getFinancePoundageList(String permit, GetFinancePoundageListRequest request);

    PageData getFirstUseProductList(String permit, GetFirstUseProductListRequest request);

    PageData getFailReasonList(String permit, GetFailReasonListRequest request);

    PageData getPlanList(String permit, String orderId);

    Lsh金融设置Model getProductById(int id);

    Lsh金融设置Model saveProduct(Lsh金融设置Model model);

    boolean saveFailReasonStatus(int id, String status);

    boolean saveFinanceChargeList(List<Lsh金融机构设置Model> modelList);

    List getFinanceOrg(String permissionCode);

    List getApplicableFinanceOrg(String permissionCode);

    List<Lsh金融设置Model> saveProductBatch(List<Lsh金融设置Model> modelList);

    Object getFinanceInfoByID(int id);

    Map getStatisticsNumber(String permissionCode);

    List<报价金融表Model> savePlanList(int orderId, List<报价金融表Model> modelList);

    boolean saveOrderFailReason(int orderId, Integer reasonId);

    List getFinanceProductListBySeries(String permit, GetFinanceProductListBySeriesRequest request);

    List<Lsh先享后选设置Model> saveFirstUseSettings(List<Lsh先享后选设置Model> modelList);

    boolean delProduct(int id);

    Lsh金融申请Model saveFinanceApply(Lsh金融申请Model model);

    List getFinaceProUpdateInfo(String permit);

    List getFinaceInstitutionPoundage(String permit);

    List getFinaceCodeByFinaceProCode(String proCode, String permit);

    List getFirstUseProUpdateInfo(String permit);

    PageData getFirstUseProduct(GetFirstUseProductListRequest request);

    boolean getHotLeverByCondition(GetHotLeverByConditionRequest request);

    boolean checkFinanceProduceIfExit(String financeProName);

    boolean saveOrUpdXXHXFinanceSet(SaveOrUpdXXHXFinanceSetInfo request);

    boolean delLSHFinanceSYCarType(Integer financeNum);

    ResultData saveOrUpdLshFinanceByPermitAndProNum(SaveOrUpdXXHXFinanceSetInfo request);

    ResultData delLSHFinanceSet(DelLSHFinanceSetRequest request);

    ResultData getfinancialIdList(String numer, String permit);

    ResultData getfinancialorgsAnddetailone(String permit, getfinancialFailAllListitemtwo re);

    ResultData getfinancialorgsAnddetailtwo(String permit, getfinancialFailAllListitemtwo re);

    ResultData getFinancialStandardFailList(String permit, RequestBase reb);

    ResultData getFinancialStandardFailDetailList(String permit, RequestBase reb);

    ResultData saveFinancialStandardFail(String permit, String user, getfinancialFailitem reli);

    ResultData updatefinancialFailStatusitem(int ids);

    ResultData getFinancialAnnualDetailList(String permit, String username, getfinancialFailAllListitemtwo re, int a, int b);


    ResultData saveFinancialServiceFee(String permit, String postman, List<financialDetailitemList> reli);

    ResultData findfinancialDetailitemList(String permit, findfinancialDetailitemList result, String date);

    ResultData getTrackfinancialDetailitem(Dates date);

    ResultData updatefinancialDetailitem(String permit, String userName, financialDetailitemList financial);

    ResultData addfinancialDetailitem(String permit, String userName, financialDetailitemList financial);


    ResultData getFinancialBenzDetailList(String permit, String postman, getfinancialFailAllListitemtwo re, int a, int b);

    ResultData getFinancialCommonDetailList(String permit, String o, getfinancialFailAllListitemtwo re, int a, int b);

    ///
    ResultData getFinancialCommonDetailSingle(String quoteId);

    ResultData getFinancialAnnualDetailSingle(String quoteId);

    ResultData getFinancialBenzSingleIntentionDetail(String quoteId);


    ResultData saveCommonFinancialOffer(getfinancialFailAllListitemtwothreefors re, String postman, String permit);

    ResultData saveCommonFinancialAllOfferApprove(getfinancialFailAllListitemtwothreefors re, String postman, String permit);

    ResultData saveFinanceMortgage(getfinancialFailAllListitemtwothreefors re, String postman, String permit);

    ResultData saveBenzFinancialOfferAndScheme(getfinancialFailAllListitemtwothreefors re, String postman, String permit);

    ResultData getBenzCounter(getCounter re, String postman, String permit);

    ResultData getBenzCounterFinanceCase(getCounter re, String postman, String permit);

    Map getBenzCounterMonthMoney(getCounter re, String postman, String permit);

    ResultData saveAnnualPayFinanceInfo(getfinancialFailAllListitemtwothreeforss re, String postman, String permit);

    ResultData getLoanClientFinancialList(getfinancialFailAllListitemtwothreeforss re, String postman, String permit);


    ResultData getSingleLoanClientFinancial(getfinancialFailAllListitemtwothreeforss re, String postman, String permit);

    ResultData getSingleLoanClientFinancialAndGift(getfinancialFailAllListitemtwothreeforss re, String postman, String permit);

    ResultData saveGiftInfoAndClientInfo(getfinancialDetailitemonesixitem re, String permit, String postman);

    ResultData getLoanClientAndFailMsg(GetFinancePoundageListRequest re, String permit);

    ResultData getFinancialAnnualDetailSingleApprove(GetFinancePoundageListRequest re, String permit);

    ResultData saveActivateFinancialFail(GetFinancePoundageListRequest re, String permit);


    ResultData saveFinancialFailStatus(GetFinancePoundageListRequest re, String permit, String postman);


    ResultData getLoanClientDetaiNoFail(GetFinancePoundageListRequest re, String permit);

    ResultData getFinancialAnnualSingleApproveDetail(GetFinancePoundageListRequest re, String permit);


    ResultData saveLoanClientFinanceApproveStatus(getkobejamesandoneal re, String postman, String permit);

    /**
     * 保存金融礼品
     *
     * @param list
     * @param initialNum
     * @param username
     * @return
     */
    public ResultData saveGift(List<GetGift> list, String initialNum, String username);

    public ResultData findFinanceServeFreeGuidance(String permit);

    public ResultData saveFinanceServeFreeGuidance(String permit, String username, GetFinanceServeFreeGuidance getFinanceServeFreeGuidance);

    ResultData getRevokeInfo(String permit);

    ResultData getRevokeLastUpdateInfo(String permit);

    ResultData saveRevokeInfo(String permit, String userName, RevokeInfo revokeInfo);

    ResultData getScAndFcChatlog(String permit, String userName, getfinancialFailAllListitemtwothreeforss revokeInfo);

    ResultData getLoanPageOffer(String permit, String userName, getfinancialFailAllListitemtwothreeforss revokeInfo);

    ResultData getLoanApproveLog(String permit, String userName, getfinancialFailAllListitemtwothreeforss revokeInfo);


    ResultData saveApproveHisitoryAndFianceOrganize(String permit, String userName, getfinancialFailAllListitemtwothreeforss revokeInfo);

    ResultData getFinanceOrgsAndYearRateList(String permit, String postman, getCounter re);

    ResultData getIsBelongToOrgs(String permit, String postman, getCounter re);

    ResultData getAllRateByFinanceType(getFinanceItem item, String permit, String userName);

    List<QuoteFinanceInfo> getFinanceSettings(String dlcode, String carId, String companyId, String yearRate,
                                              String loanterm, String downRate, String balRate, String loanAmount, String type);

    ResultData getMonthlyMortgagePayment(String dlcode, String carId, String companyId, String yearRate,
                                         String loanterm, String downRate, String balRate, String loanAmount, String msrp);

    ResultData getFinanceSettingsToPC(String permit, FinanceSetting financeSetting);

    ResultData getMonthlyMortgagePaymentToPC(String permit, FinanceSetting financeSetting);

    ResultData getLastReplace(String permit);


    void exportFinanceAccountInfo(String permit, HttpServletResponse response, GetExportFinanceAccountInfoParam getExportFinanceAccountInfoParam);

    void exportFinanceLoanInfo(String permit, HttpServletResponse response, GetExportFinanceAccountInfoParam getExportFinanceAccountInfoParam);

    ResultData getSettings(String permit,String name);


    ResultData saveSettings(String permit,String name,String  type,String userName);

    ResultData saveDealerCustomFinanceProductHotRank(String permit, FinanceService.SaveDealerCustomFinanceProductHotRankReq req);

    ResultData getFinanceProduceNum(String permit, String companyName, String carCode);

    ResultData getFinanceFee (String carId, String loanAmount);

    ResultData getSuitableArea();

    ResultData getSuitableStore(Integer id);

    List getFinDefeatedReson();

    ResultData getFinanceInfoByName(String name);

    static class getfinancialDetailitemonesixitem {
        public String chushibianhao;

        // 客户信息
        public String x1;// 贷款人 类型    //
        public String x2;// 姓名
        public String x3;//称谓
        public String x4;// 贷款人身份证
        public String x5;// 贷款人 电话
        public String x6;//  贷款人的 省份
        public String x7;//  贷款人的 城市
        public String x8;//  贷款人行政区
        public String x9;// 邮政编码
        public String x10;// 贷款人的 详细地址

        public String bDiscount;//(是否贴息);
        public String discountAmount;//(贴息金额)
        // 联系人 姓名
        public String y2;
        //称谓
        public String y3;
        //身份证
        public String y4;
        //电话
        public String y5;
        //省份
        public String y6;
        // /城市
        public String y7;
        //行政区
        public String y8;
        //邮政编码
        public String y9;
        //  详细地址
        public String y10;


    }

    static class GetGift {
        public String gift;// 礼品
        public String giftNum;// 礼品数 sum
    }

    static class getkobejamesandoneal extends RequestBase {

        public String bill;// 初始报价单号

        public String issole;
        public String issoledate; // 撤单日期
        public String issolereason;// 原因

        public String iscustomer; // 是否退还给 客户
        public String iscustomermoney;// 退款金额

        public String iscustomertwo;
        public String iscustomertwodate; // 重新申请日期
        public String iscustomermoneytwo; // 金融服务费

        public String sucessdate;  // 完成抵押
        public String sucessfunldate; // 付款到账

        public String applyType; // 0 通过  1 不通过   2 条件批复
        public String applyDate; // 格式 yyyy-MM-dd


        public String fianceOrgs; //  金融机构

    }

    static class getfinancialFailAllListitemtwothreeforss extends RequestBase {

        public Integer baojiaid;// 报价编号
        public Integer finaceid; //金融编号
        public String uname;//名字                        贷款人姓名
        public String usex;//性别                          贷款人类型
        public String utel;//                               贷款人联系方式
        public String uwantcartype;//意向车型
        public String newcarsolestatus; //新车销售状态          审批后状态跟踪
        public String solebusiness;//零售商
        public String soleuser; //销售顾问
        public String carprice; //车价

        public String financialStel; // 金融机构

        public String anjietype; //按揭类型
        public String rexiaorank;// 热销级别
        public String finaceorgs;//金融机构   奔驰租赁 也有
        public String statustype;//利率和 费率类型
        public String statustypesum;//利率和 费率 具体数据

        public String daiktype;//贷款类型
        public String baozhengbili;//保证比例
        public String daikuanmoney;// 贷款额
        public String baozhengjinge;//保证金额
        public String shoufubili;//首付比例
        public String shoufujinge;// 首付金额   奔驰租赁的  预付金额
        public String weikbili;//尾款比例
        public String weiikjinge;//尾款金额
        public String trueqishu;

        public String qishuid1;//期数编号1
        public String qishuid2;//期数编号2
        public String qishuid3;//期数编号3
        public String qishuid4;//期数编号4

        public String qishu1s;//期数1 对应的 还款额
        public String qishu2s;//期数2对应的 还款额
        public String qishu3s;//期数3对应的 还款额
        public String qishu4s;//期数4对应的 还款额

        public String qishu1;//期数1
        public String qishu2;//期数2
        public String qishu3;//期数3
        public String qishu4;//期数4


        public String yuefuri;//月付额 就是 月供
        public String jingrfuwufee;//金融服务费  奔驰也有
        public String paymoneyqi;// 还款结束期
        public String paymoneysum;//还款额
        public String detail;//备注

        public String chushibaojiabianhao;// 初始报价编号
        public String jingesolestatus1;// 金融销售状态1
        public String jingesolestatus2;// 金融销售状态2
        public String yixiangfanan;// 意向方案申请
        public String yixiangdate;// 意向方案日期
        public String shenqingjieguo;// 申请结果
        public String shenqingjieguodate;// 申请结果日期
        public String zhunreason;// 全款原因
        public String failreason;// 战败原因

        public String financeFee;
        public String financePlan;//金融产品编码
        public String applyStartDate; // 申请日期 开始
        public String applyEndDate;  // 申请日期  截止
        public String applyPassStartDate; // 申请通过日期 开始
        public String applyPassEndDate; // 申请通过日期 截止
        public String loanStartDate;  // 放款到账日期  开始
        public String loanEndDate;   // 放款到账日期 截止


    }

    static class getfinancialFailAllListitemtwothreefors {

        public Integer baojiaid;// 报价编号
        public Integer finaceid; //金融编号
        public String uname;//名字
        public String usex;//性别
        public String utel;//名字
        public String uwantcartype;//意向车型
        public String newcarsolestatus; //新车销售状态
        public String solebusiness;//零售商
        public String soleuser; //销售顾问
        public String carprice; //车价

        public String baozhibili;
        public String anjietype; //按揭类型
        public String rexiaorank;// 热销级别
        public String finaceorgs;//金融机构   奔驰租赁 也有
        public String statustype;//利率和 费率
        public String statustypesum;//利率和 费率 具体数据
        public String isannualpay;//是否是 annualpay
        public String daiktype;//贷款类型
        public String baozhengbili;//保证比例
        public String baozhengjinge;//保证金额
        public String shoufubili;//首付比例   奔驰租赁 也有
        public String shoufujinge;// 首付金额   奔驰租赁的  预付金额
        public String weikbili;//尾款比例
        public String weiikjinge;//尾款金额

        public String qishu;//期数
        public String yuegong;//月供    奔驰租赁的  也有
        public String jingrfuwufee;//金融服务费  奔驰也有

        public String detail;//备注

        public String foodtype;// 产品类型
        public String yeartranssum;// 年公里数
        public String baozhengmoneybili;// 保证金比例
        public String xiuyangtaocang;// 修养套餐
        public String daikjine;// 贷款额
        public String hongtqi;// 合同期    贷款期数
        public String baozhimoney;// 保值金额

        public String chushibaojiabianhao;// 初始报价编号
        public String jingesolestatus1;// 金融销售状态1
        public String jingesolestatus2;// 审批进度

        public String yixiangfanan;// 意向方案申请
        public String yixiangdate;// 意向方案日期
        public String shenqingjieguo;// 申请结果

        public String shenqingjieguodate;// 申请结果日期
        public String zhunreason;// 全款原因
        public String failreason;// 战败原因

        public String financeProductId;//金融设置--金融编号
        public String financeProductNum;//金融设置--产品编码
        public String financeFee;//金融手续费
    }

    static class GetFinanceInfoListRequest extends RequestBase {
        public String permit;
        public String username;
        public String userPhone;
        public String financeCompany;
        public String financeStatus;
        public String financeProduct;
    }

    static class GetFinanceProductListRequest extends RequestBase {

        public String productType;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date startDate;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date endDate;
        public String startAnnualRate;
        public String endAnnualRate;
        public String code;
        public String isValid;
        public String permissionCode; // 要么是"LSH"，要么是经销商许可编号
        public String period;
        public String anJieType;
        public String IsStandard;
        public String brand;//适用品牌
    }

    static class GetFinancePoundageListRequest extends RequestBase {

        public String permissionCode;
        public String reason;
    }

    static class GetFirstUseProductListRequest extends RequestBase {

        public String brand;
        public String carCode;
        public String carDetail;
        public String source;
        public String level;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date startDate;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date endDate;
        public String startAnnualRate;
        public String endAnnualRate;
        public String param;
        public String permissionCode;
    }

    static class GetFailReasonListRequest extends RequestBase {
        public String permissionCode;
    }

    static class GetHotLeverByConditionRequest extends RequestBase {
        public String permit;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date startDate;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date endDate;
        public String trialModel;//试用车型
        public String hotLever;//热销级别
    }

    static class checkFinanceProduceIfExit extends RequestBase {
        public String 金融产品名称;//试用车型
    }

    static class SaveOrUpdXXHXFinanceSetInfo {
        public Integer 金融编号;
        public Integer 金融机构编号;
        public String 金融产品名称;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date 开始日期;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date 结束日期;
        public String 年利率;
        public Integer 最低首付比例;
        public String 是否尾款;
        public Integer 最高尾款比例;
        public String 期数;
        public String 是否固定;
        public Integer 保证金比例;
        public String 备注;
        public String 许可;
        public String 产品分类;
        public String 产品编码;
        public String si编码;
        public String 客户类别;
        public String 业务类型;
        public String 按揭类型;
        public String 贴息类型;
        public String 贴息利率;
        public String 是否热销;
        public String 热销级别;
        public String 是否有效;
        public String 是否删除;
        public String 更新账号;
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date 更新时间;
        public String 适用车型;
        public String 保值金额;
        public String 金融系列;
        public String 贴息利率B;
        public String 贷款类型;
        public  String 利率状态;
        public Integer 适用区域;
        public Integer 适用单店;
        public String 品牌;
    }

    static class GetFinanceProductListBySeriesRequest extends RequestBase {
        public String series;
    }

    static class DelLSHFinanceSetRequest extends RequestBase {
        public String 产品编码;
        public String 许可;
        public String 金融编号;
    }

    static class getfinancialFailitem {
        public String QuasiDefeat;//准战败
        public String Defeat; // 汽车金融战败

        public String failid;     //
        public String failstatus;// 战败分类
        public String failreason;// 战败原因
        public String ueringStatus;// 状态

    }

    static class getfinancialFailAllListitemtwo extends RequestBase {
        public String name;
        public String nameTel;
        public String moneyorgina;// 金融机构
        public String shenpijindu;// 审批进度
        public String solestatus;// 金融销售状态

        public String carCode;

        public String quoteId;

        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date 更新时间起始;

        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
        public Date 更新时间结束;

    }

    static class financialDetailitemList extends RequestBase {


        public String date;//tends RequestBase  {
        public String dealerName;  // 经销商名字
        public String companyCount;// 集团指导值;
        public String dealerCount;// 经销商指导值;
        public String city;//城市
        public String bigDistrict;//大区
        public String smallDistrict;//小区
        public String province;//省份
        public String permit;
    }

    static class GetFinanceServeFreeGuidance extends RequestBase {
        public String month;
        public String num;
    }

    class findfinancialDetailitemList extends RequestBase {
        public String city;//城市
        public String dealerName;  // 经销商名字
        public String dealerLogo;  // 经销商 简称
        public String cityAvgS;  //指导值小
        public String cityAvgB;  //指导值大
    }

    class Dates extends RequestBase {
        public String date;
        public String city;//城市
        public String dealerName;  // 经销商名字
        public String dealerLogo;  // 经销商 简称
        public String cityAvgS;  //指导值小
        public String cityAvgB;  //指导值大
    }

    class RevokeInfo extends RequestBase {
        public Integer id;
        public String reason;
        public String state;

    }

    class getFinanceItem extends RequestBase {

        public String finannceOrg;
        public String rateItem; // 利率数值
        public String type;// 0 是利率  1 是 费率
    }

    class getCounter {
        public String qishu;// 期数
        public String heTongSum;// 合同数

        public String prodectType;// 产品类型 0 普通 1 星时享
        public String carprice;// 车型编号
        public String type;// 类型 1 普通  2 annual  3. 先享后选
        public String oid;// 初始报价单号

        public String yearRate;// 年利率
        public String daikuanje;// 贷款金额
        public String baozhije;// 保值金额

        public String orgs;//金融机构


    }

    class FinanceSetting {
        public String carId;        //车型编号
        public String companyId;    //金融机构代码
        public String yearRate;     //年利率
        public String loanTerm;     //期数
        public String downRate;     //首付比例
        public String balRate;      //尾款比例
        public String type;         //筛选域类型

        public String loanAmount;   //贷款金额
        public String carAmount;   //贷款金额
    }

    class GetExportFinanceAccountInfoParam extends RequestBase{
        public String cusName;
        public String cusTel;
        public String cusType;
        public String companyName;
        public String state;
        public String applyStartDate; // 申请日期 开始
        public String applyEndDate;  // 申请日期  截止
        public String applyPassStartDate; // 申请通过日期 开始
        public String applyPassEndDate; // 申请通过日期 截止
        public String loanStartDate;  // 放款到账日期  开始
        public String loanEndDate;   // 放款到账日期 截止
    }

    class SaveDealerCustomFinanceProductHotRankReq {
        public Integer fiId; // 金融编号
        public Integer rank; // 热销级别
    }
}
